﻿<%@ Import namespace="UDS.Components"  %>
<%@ Import namespace="System.Data.SqlClient"  %>
<%@ Import namespace="System.Data"  %>
<%@ Import namespace="System"%>
<%@ Page language="c#" Codebehind="ClientListView.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.CM.ClientListView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<meta name="author" content="Herry" />
<meta name="Copyright" content="Copyright (c) 2009 himm.cn" />
<title>客户列表</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="/css/other.css" media="screen" />
<style type="text/css">
table {
	width:100%;
	border:none;
}
table th {
	background:#ccccff;
}
table th, table td {
	padding:3px;
}
table td span a, table td span a:visited {
	color:#fff;
}
.active1 {
	background:#1a499d;
}
.active2 {
	background:#337fb2;
	color:#fff;
	font-weight:bold;
}
.tabnavhead {
	text-align:right;
	position:relative;
}
.tnc {
	float:left;
	width:90px;
	height:30px;
	margin:0 0 0 5px;
	position:relative;
	bottom:0px;
}
.tnc a {
	width:90px;
	height:26px;
	display:block;
	padding:4px 0 0;
	text-align:center;
	line-height:26px;
	color:#fff;
}
.tnc a:visited {
	color:#fff;
}
.tnc a:hover {
	color:#ff0;
}
.path .right {
	padding:6px 0 0;
}
.redButtonCss {
    font-family: "Tahoma", "宋体";
    font-size: 9pt; color: #0066cc;
    border: 1px #93bee2 solid;
    background-image:url(/Images/redbuttonbg.gif);
    background-color: #fff;
	cursor:pointer;
    font-style: normal ;
}
</style>
<script runat="server" id="Script1">
		private string GetUpdateTime(DataRow[] row)
		{
			if(row.Length!=0)
			{
				return(row[0]["UpdateTime"].ToString());
			}
			else
				return ("");
		}
		private string GetCurStatus(string curstatus)
		{
			
			switch(curstatus.Split(',')[0])
			{
				case "trace":
					return ("跟踪");
					break;
				case "boot":
					return ("启动");
					break;
				case "commend":
					return ("产品推荐");
					break;
				case "requirement":
					return ("需求定义");
					break;
				case "submit":
					return ("方案提交");
					break;
				case "negotiate":
					return ("商务谈判");
					break;
				case "actualize":
					return ("项目实施");
					break;
				case "traceservice":
					return ("跟踪服务");
					break;
				case "last":
					return ("收尾款");
					break;
			}
			return("");
		}
		private string GetAddMan(DataRow[] row)
		{
			if(row.Length!=0)
			{
				return(row[0]["Realname"].ToString());
			}
			else
				return ("");
		}
		private string GetLinkmanTel(DataRow[] row)
		{
			if(row.Length!=0)
			{
				return(row[0]["Mobile"].ToString());
			}
			else
				return ("");
		}
		private string GetClientNameUrl(string clientid)
		{
			if(ViewState["NowTab"].ToString()=="client")
			{
				return("Client.aspx?ClientID="+clientid);
			}
			else
			{
				return("#");
			}
		
		}
		private string GetContactUrl(string clientid)
		{
			if((ViewState["NowTab"].ToString()=="client") && (Session["cm_permission"]=="administrator"))
			{
				return("ClientContact_thisWeek.aspx?ClientID="+clientid);
			}
			else
			{
				return("ClientHistoryContact.aspx?ClientID="+clientid);
			}
		}
		</script>
		<script>
		function selectAll()
		{
			var len=document.ClientListView.elements.length;
			var i;
		    for (i=0;i<len;i++){
			if (document.ClientListView.elements[i].type=="checkbox"){
		        document.ClientListView.elements[i].checked=!document.ClientListView.elements[i].checked;								
						 }
					}
		}
		
		</script>
</head>
<body>
<form id="ClientListView" method="post" runat="server">
<div class="m">
  <div class="path">
  <span class="right">查看视角<asp:dropdownlist id="ddl_MySubordinate" runat="server" AutoPostBack="True"></asp:dropdownlist></span>
    <a href="/SubModule/UnitiveDocument/">我的桌面</a> >> 我的客户</div>
    <div class="con">
    <div class="tr">

            <asp:panel id="pnl" runat="server" Width="499px" Visible="true"> <input class="redbuttoncss" id="Button2" onclick="window.open('Stat/Contact_Client.aspx','_blank')" type="button" value=" 汇 总" name="Button1"> <input class="redbuttoncss" id="Button1" onclick="window.open('Search/ClientInfo.aspx','_blank')" type="button" value=" 查 询" name="Button1"> <input class="redbuttoncss" onclick="selectAll()" type="button" value="全 选"><asp:Button id="btn_Del" runat="server" CssClass="redbuttoncss" Text="删 除" OnClick="btn_Del_Click"></asp:Button>
<asp:Button id="btn_AddClient" runat="server" CssClass="redbuttoncss" Text="添加客户" OnClick="btn_AddClient_Click"></asp:Button>
<asp:Button id="btn_AddLinkman" runat="server" CssClass="redbuttoncss" Text="添加联络人" OnClick="btn_AddLinkman_Click"></asp:Button>
<asp:Button id="btn_AddContact" runat="server" CssClass="redbuttoncss" Text="添加接触" OnClick="btn_AddContact_Click"></asp:Button></asp:panel>
            </div>
    
    
  <div class="tabnav">
        <p class="tabnavhead"> 
	  <span id="bar1" runat="server">
          	<asp:linkbutton id="lbtn_MyClient" runat="server" OnClick="lbtn_MyClient_Click" >我的客户</asp:linkbutton>
          </span> 
	  <span id="bar2" runat="server">
	  	<asp:linkbutton id="lbtn_coClient" runat="server" OnClick="lbtn_coClient_Click">我的协同客户</asp:linkbutton>
          </span>
	  	<asp:panel id="pnl_ClientInfo" runat="server" CssClass="tr">&nbsp;共<asp:Literal id="ltl_ClientCount" runat="server"></asp:Literal>位客户,一个月内共接触<asp:Literal id="ltl_ContactTimes" runat="server"></asp:Literal>次</asp:panel>
        </p>
      </div>
      
      
<asp:datagrid id="dgd_Client" runat="server" Width="100%" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" BorderColor="#337FB2" BorderWidth="1px" CellPadding="3" PageSize="15" DataKeyField="ID">
	<AlternatingItemStyle BackColor="#E8F4FF"></AlternatingItemStyle>
	<ItemStyle ></ItemStyle>
	<HeaderStyle ForeColor="White" BackColor="#337FB2"></HeaderStyle>
	<Columns>
		<asp:TemplateColumn>
			<HeaderStyle Width="20px"></HeaderStyle>
			<ItemStyle HorizontalAlign="Right"></ItemStyle>
			<ItemTemplate>
				<asp:CheckBox Runat="server" ID="cbx1"></asp:CheckBox>
			</ItemTemplate>
		</asp:TemplateColumn>
		<asp:BoundColumn Visible="False" DataField="ID" SortExpression="ID" HeaderText="编号"></asp:BoundColumn>
		<asp:TemplateColumn SortExpression="Name" HeaderText="客户名称">
			<ItemTemplate>
				<asp:HyperLink ID="hlk_ClientName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>' NavigateUrl='<%# GetClientNameUrl(DataBinder.Eval(Container,"DataItem.ID").ToString())%>' Target=_blank>
				</asp:HyperLink>
			</ItemTemplate>
		</asp:TemplateColumn>
		<asp:BoundColumn DataField="Linkman" SortExpression="Linkman" HeaderText="联系人">
			<ItemStyle ></ItemStyle>
		</asp:BoundColumn>
		<asp:TemplateColumn HeaderText="电话">
			<HeaderStyle ></HeaderStyle>
			<ItemStyle ></ItemStyle>
			<ItemTemplate>
				<asp:Label  runat="server" Text='<%# GetLinkmanTel(((DataRowView)Container.DataItem).Row.GetChildRows("ClientLinkmanID_Linkman")) %>'>
				</asp:Label>
			</ItemTemplate>
		</asp:TemplateColumn>
		<asp:BoundColumn DataField="updatetime1" SortExpression="updatetime1" HeaderText="更新时间"></asp:BoundColumn>
		<asp:TemplateColumn HeaderText="目前状态">
			<HeaderStyle ></HeaderStyle>
			<ItemStyle ></ItemStyle>
			<ItemTemplate>
				<asp:HyperLink id=HyperLink1 runat="server" Text='<%# GetCurStatus(DataBinder.Eval(Container,"DataItem.Curstatus").ToString()) %>' Target="_blank" NavigateUrl='<%# GetContactUrl(DataBinder.Eval(Container,"DataItem.ID").ToString())%>'>
				</asp:HyperLink>
			</ItemTemplate>
		</asp:TemplateColumn>
		<asp:TemplateColumn SortExpression="AddManID" HeaderText="添加人">
			<HeaderStyle HorizontalAlign="Right"></HeaderStyle>
			<ItemStyle  HorizontalAlign="Right"></ItemStyle>
			<ItemTemplate>
				<asp:Label runat="server" Text='<%# GetAddMan(((DataRowView)Container.DataItem).Row.GetChildRows("ClientAddMan_Staff")) %>' ID="Label1">
				</asp:Label>
			</ItemTemplate>
		</asp:TemplateColumn>
	</Columns>
	<PagerStyle NextPageText="上一页" PrevPageText="下一页" HorizontalAlign="Right" BackColor="#E8F4FF" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
    </div>
  </div>
</form>
</body>
</html>
